#include <iostream>
using namespace std;
int main()
{
    const int N=3;
    int a;
    cout<<"Vvedite a ";
    cin>>a;
    int i=1;
    while(1)
    {
        i*=N;
        if(i==a)
        {
            cout<<"true\n";
            break;
        }
        else if(i>a)
        {
            cout<<"false\n";
            break;
        }
     }
     return 0;
}
